package com.imooc.scala.course04

object SimpleObjectApp {
  def main(args: Array[String]): Unit = {
    val person = new People()
    person.name="tom"
    println(person.name + "..." + person.age)
    println("invoke eat method : "+ person.eat)

    person.watchFootball("Barcelona")

    person.printInfo()

    println(person.age)
  }

}

class  People{
  //定义属性
  var name:String = _  // 占位符 val是不可以的   string占位符为null, 此处不能去掉String  ，因为不知道类型
  val age = 10

  private [this] val gender = "male" //private [this] 在class内部才能进行访问，以外访问不到

  def printInfo(): Unit ={
    println("gender:"+ gender)
  }

  def eat():String={
    name + "eat..."
  }

  def watchFootball(teamName:String): Unit ={
    println(name + "is watching match of "+ teamName)
  }

}